package com.leetcode.hash;

import java.util.Arrays;

/**
 * @author Dennis Li
 * @date 2020/7/19 20:37
 */
public class ContainsDuplicate_217 {

    public boolean containsDuplicate(int[] nums) {
        Arrays.sort(nums);
        for (int i = 0, j = nums.length - 1; i < j; i++, j--) {
            if(nums[i] == nums[i + 1] || nums[j] == nums[j - 1])
                return true;
        }
        return false;
    }

}
